import { DB } from "@/lib/db";
import { faker } from "@faker-js/faker";
import { users, UserSchema } from "@supersavely/db/schema";

const mock = () => {
  const data: Omit<Extract<UserSchema, { mode: "signUp" }>, "mode">[] = [];

  for (let i = 0; i < 5; i++) {
    data.push({
      name: faker.internet.userName(),
      email: faker.internet.email(),
      passwordHash: faker.internet.password({ length: 4 }),
    });
  }

  return data;
};

export async function seed(db: DB) {
  console.log("start seeding users");
  await db.insert(users).values(mock());
}
